import request from "@/utils/request";

// 查询优惠券配置列表
export function listCouponConfig(query) {
  return request({
    url: "/service/couponConfig/list",
    method: "get",
    params: query,
  });
}

// 查询优惠券配置详细
export function getCouponConfig(id) {
  return request({
    url: "/service/couponConfig/" + id,
    method: "get",
  });
}

// 新增优惠券配置
export function addCouponConfig(data) {
  return request({
    url: "/service/couponConfig",
    method: "post",
    data: data,
  });
}
// 优惠券发放
export function sendCoupon(data) {
  return request({
    url: "/service/couponConfig/send/" + data?.id,
    method: "get",
    params: { ...data, qStringify: true },
  });
}

// 修改优惠券配置
export function updateCouponConfig(data) {
  return request({
    url: "/service/couponConfig",
    method: "put",
    data: data,
  });
}

// 删除优惠券配置
export function delCouponConfig(id) {
  return request({
    url: "/service/couponConfig/" + id,
    method: "delete",
  });
}
